#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

//void reserve(int* a, int left, int right)
//{
//    while (left < right)
//    {
//        int tmp = a[left];
//        a[left] = a[right];
//        a[right] = tmp;
//        left++;
//        right--;
//    }
//}
//void rotate(int* nums, int numsSize, int k)
//{
//    k = k % numsSize;
//    reserve(nums, 0, numsSize - k - 1);
//    reserve(nums, numsSize - k, numsSize - 1);
//    reserve(nums, 0, numsSize - 1);
//}
int missingNumber(int* nums, int numsSize)

{
    int num = 0;
    for (int i = 0; i <= numsSize; i++)
    {
        num ^= i;
    }
    for (int i = 0; i < numsSize; i++)
    {
        num ^= nums[i];
    }
    return num;
}
int main()
{
    int nums[] = {0,1,2,3,4,6,7,8,9};
    int numsSize = sizeof(nums) / sizeof(nums[0]);
    int k = 6;
    //rotate(nums,numsSize,k);

   int ret = missingNumber(nums, numsSize);
   printf("%d", ret);
    /*for (int i = 0; i < numsSize; i++)
    {
        printf("%d", nums[i]);

    }
    printf("%s", nums);*/
}


